li = [54, 26, 93, 17, 77, 31, 44, 55, 20]
step = len(li) // 2
while step != 0:
    for i in range(step, len(li)):
        # print(li)
        for j in range(i, step-1, -step):
            if li[j] < li[j - step]:
                print(j-step)
                li[j], li[j - step] = li[j - step], li[j]
            else:
                break
    step //= 2
print(li)
